"use strict";

var mysql = require('mysql');
var config = require('./config');

module.exports.select = function(sql,callback){
	var connection = mysql.createConnection({
        host    : config.mysql.hostname,
        user    : config.mysql.username,
        password: config.mysql.root,
		database: config.mysql.database
	});

	connection.connect();

	connection.query(sql, function(err, rows, fields) {
		if (err) throw err;
		callback(err,rows);
	});

	connection.end();
};